<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>营收编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="__TMPL__/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="__TMPL__/css/admin.css" media="all">
	<script type="text/javascript" src="__TMPL__/js/jquery.min.js"></script>
	<script type="text/javascript" src="__TMPL__/layui/layui.js"></script>
	<script type="text/javascript" src="__TMPL__/js/admin.js"></script>
    <script type="text/javascript" src="__TMPL__/layui/lay/modules/util.js"></script>
    <style>
        html{
            background-color: #ffffff;
        }
    </style>
</head>
    <div class="layui-card">
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
             style="padding: 20px 30px 15px 0;">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">公司名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="company" value="{$info.company|default=''}" lay-verify="required" placeholder="公司名称" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">金额</label>
                    <div class="layui-input-inline">
                        <input type="text" name="money" value="{$info.money|default=''}" lay-verify="required" placeholder="金额" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">转账时间</label>
                <div class="layui-input-block">
                    <input type="text" name="transfer_time" id="transfer_time" lay-verify="required" value="{$info.transfer_time}" placeholder="转账时间" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">产品</label>
                <div class="layui-input-block">
                    <volist name="products" id="product">
                        <input type="radio" name="product_id" value="{$key}" title="{$product}" <eq name="info.product_id" value="$key">checked</eq>>
                    </volist>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">运营</label>
                <div class="layui-input-block">
                    <select name="operation_id" lay-filter="required">
                        <option value="">请选择运营</option>
                        <volist name="operations" id="voo">
                            <option value="{$voo.id}" <eq name="info.operation_id" value="$voo.id">selected</eq>>{$voo.name}</option>
                        </volist>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">业务</label>
                <div class="layui-input-block">
                    <select name="business_id" lay-filter="required">
                        <option value="">请选择业务</option>
                        <volist name="business" id="vo">
                            <option value="{$vo.id}" <eq name="vo.id" value="$info.business_id">selected</eq>>{$vo.name}</option>
                        </volist>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="type" value="1" title="新单"  <eq name="info.type" value="1">checked</eq>>
                    <input type="radio" name="type" value="2" title="续费" <eq name="info.type" value="2">checked</eq>>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="remark" placeholder="请输入内容" class="layui-textarea">{$info.remark}</textarea>
                </div>
            </div>
            <input type="hidden" name="income_id" value="{$info.id|default=0}">
            <input type="hidden" name="department_id" value="{$department_id}">
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
            </div>
        </div>
</div>
    <script>
    layui.config({
        base: '__TMPL__/public/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','admin','laydate'], function(){
        var $ = layui.$
            ,form = layui.form
            ,admin = layui.admin,
            laydate = layui.laydate;

        laydate.render({
            elem: '#transfer_time',
            type:'datetime'
        });

        //监听提交
        form.on('submit(layuiadmin-app-form-submit)', function(data){
            var field = data.field;
            var index = parent.layer.getFrameIndex(window.name);
            admin.req({
                url: "{:url('income/do_operate')}",
                method:'post',
                type:'json',
                data:field,
                done:function (res) {
                    if(res.code===1){
                        layer.msg(res.msg, function(){
                            parent.layui.table.reload('dataTable'); //重载表格
                            parent.layer.close(index); //再执行关闭
                        });
                    }else{
                        layer.msg(res.msg, {icon: 5});
                    }
                }
            });
        });
    })
</script>
</body>
</html>